package com.zcf.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zcf.mapper.PayMapper;
import com.zcf.pojo.Pay;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.swing.text.html.parser.Entity;

/**
 * @author ： jsq
 * @date ：2019/10/13 22:24
 * @description : 战绩
 * @path : com.ggh.service.impl.RoomRecordServiceImpl
 * @modifiedBy ：
 */
@Service
public class PayServiceImpl extends ServiceImpl<PayMapper, Pay>  {
    /**
    * @description :绑定支付宝
    * @return: boolean
    * @date : 2019/10/14 15:15
    * @author : jj
    * @throws
    */
    @Transactional(rollbackFor = Exception.class)
    public boolean addpay(Pay pay){
        int insert = baseMapper.insert(pay);
        if (insert>0){
            return true;
        }
        return false;
    }

    /**
     * 更新支付宝
     * @param pay
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public int update(Pay pay) {
        int insert = baseMapper.updateById(pay);
        return 0;
    }
    /**
    * @description :查询相关支付宝账号
    * @param pay
    * @return: com.ggh.entity.Pay
    * @date : 2019/10/14 16:53
    * @author : jj
    * @throws
    */
    public Pay query(Pay pay){
        Pay alpay=baseMapper.selectOne(pay);
       return alpay;
    }

}
